Integrating Yandex Mediation
Warning
Be sure to update to the latest adapter versions (Yandex Mobile Mediation and adapters for third-party mediation networks). Otherwise, errors from improper adapter integration might occur, preventing the ad from being served.
Mobile mediation is a platform that automatically selects ads from a variety of ad networks using ML algorithms, which helps you maximize your revenue. All settings are preconfigured, so you can start using it immediately without having to set up each network individually.
If you've been using the Mobile Ads SDK with a single Yandex network, migrating to Yandex Mediation requires no code changes. You only need to preset the sections of third-party advertising networks' web interfaces.
Mobile Ads Unity is a plugin for the Unity3d gaming platform, which includes support for the Yandex Mobile Ads SDK.
Prerequisites
To prepare your app, follow the steps described in the next sections.
App requirements
- To use this SDK, your app's Target API Level must be set to 31 or above.
- To load any type of ad, iOS version 13 or higher is required.
- Use Xcode 15 or higher.
Set up the app in your Yandex Advertising Network account
Here's how to register your app in the Yandex Advertising Network:
- Log in or register your account in the Yandex Advertising Network.
- Register your app in the Yandex Advertising Network.
Integration
Warning
yandex-ads-unity-plugin
only runs in Android and iOS environments. Currently, ads can't be loaded and displayed in the Unity editor.
There are two integration methods:
- Single build (recommended): All available adapters are connected automatically.
- Connecting individual adapters: Install the Yandex SDK with the lite package and connect specific adapters separately using the appropriate packages.
You can connect all available adapters automatically using the common yandex-mobileads-mediation
package.
-
Set up mediation in the Partner interface.
-
Download the yandex-ads-unity-plugin directory and add the package
yandex-mobileads-mediation-7.6.0.unitypackage
. You will also be prompted to install the Google resolver. If you've already added the Google resolver to your project, uncheck the box.How to add a package
Select the required plugin (Assets → Import Package → Custom Package) and click Import.
-
Use the Google resolver to install dependencies: enable auto-resolve or select the menu item Assets → External Dependency Manager → Android Resolver → Resolve.
-
To test the Mobile Ads Unity plugin, use one of the demo scripts in the samples directory of the yandex-ads-unity-plugin repository. Copy the script to the project directory and add it as a Component to the main camera.
-
Additional settings for the Google AdMob (ex. AdMob) network
-
For Android, create the main AndroidManifest.xml file via File → Build Settings → Android → Player Settings → Publishing Settings → Custom Main Manifest (check the box).
Add your App ID to the created AndroidManifest.xml application file using the
<meta-data>
tag namedcom.google.android.gms.ads.APPLICATION_ID
.<manifest> <application> <!--...--> <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/> <!--...--> </application> </manifest>
-
In your generated Xcode project for iOS, add the key
GADApplicationIdentifier
with yourapp ID
to the Info.plist file.<key>GADApplicationIdentifier</key> <string>ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy</string>
Learn more about where you can find the Google App ID
-
To connect individual adapters, add a package with a supported yandex-mobileads-lite-x.x.x.unitypackage
version and and follow the specific instructions for each adapter to enable them:
-
Set up mediation in the Partner interface.
-
Download the yandex-ads-unity-plugin directory and add the package
yandex-mobileads-lite-7.6.0.unitypackage
. You will also be prompted to install the Google resolver. If you've already added the Google resolver to your project, uncheck the box.How to add a package
Select the required plugin (Assets → Import Package → Custom Package) and click Import.
-
Use the Google resolver to install dependencies: enable auto-resolve or select the menu item Assets → External Dependency Manager → Android Resolver → Resolve.
-
To test the Mobile Ads Unity plugin, use one of the demo scripts in the samples directory of the yandex-ads-unity-plugin repository. Copy the script to the project directory and add it as a Component to the main camera.
-
Connect the required adapters separately using the appropriate packages.